<?php

use App\Enums\ReceptionType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateReceptionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('receptions', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->default(0)->comment('员工');
            $table->unsignedTinyInteger('type')->default(ReceptionType::SALE)->comment('类型');
            $table->unsignedInteger('today_number')->default(0)->comment('今日接待数(每日凌晨重置)');
            $table->unsignedInteger('daily_number')->default(0)->comment('每日接待上限');
            $table->unsignedTinyInteger('weight')->default(1)->comment('权重');
            $table->boolean('status')->default(true)->comment('状态');
            $table->text('wechat')->nullable()->comment('微信二维码');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('receptions');
    }
}
